home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************
- Live(Hotmail)
- ***********************************************************/
- var hostString="hotmail.com";
- var supportInboxOnly=true;
- var supportShowFolders=true;
-
- function init(){
- this.initStage=ST_PRE;
- this.loginData=["","login","passwd"];
- this.dataURL="http://mail.live.com/?rru=inbox";
- this.mailURL="http://mail.live.com/?rru=inbox";
- this.mailDomain="mail.live.com";
- if(this.password.length>16)this.password=this.password.substring(0,16);
- }
- function getIconURL(){
- return "http://login.live.com/favicon.ico";
- }
- function process(aHttpChannel, aData) {
- switch(this.stage){
- case ST_PRE:
- this.getHtml("http://mail.live.com/mail/logout.aspx");
- return false;
- case ST_PRE_RES:
- this.getHtml("http://mail.live.com");
- return false;
- case (ST_PRE_RES+1):
- var fnd=aData.match(/srf_uPost=\'([\s\S]+?)\'/);
- if(fnd){
- this.loginData[LOGIN_URL]=fnd[1];
- fnd=aData.match(/PPFT[\s\S]+?value=\"(\S+?)\"/);
- if(fnd){
- this.stage=ST_LOGIN;
- this.getHtml(this.loginData[LOGIN_URL],this.loginData[LOGIN_POST]+"&PPFT="+encodeURIComponent(fnd[1]));
- return false;
- }
- }
- this.onError();
- return true;
- case ST_LOGIN_RES:
- var fnd=aData.match(/<form.+?action="(.+?)"/);
- if(fnd){//@msn.com
- var fnd0=aData.match(/<input.+?name=[\'\"](\S+?)[\'\"].+?value=[\'\"](\S+?)[\'\"]/);
- var post;
- if(fnd0){
- post=fnd0[1]+"="+encodeURIComponent(fnd0[2]);
- }
- this.getHtml(fnd[1],post);
- return false;
- }else{
- fnd=aData.match(/replace\([\'\"](\S+?)[\'\"]/);
- if(fnd){
- this.getHtml(fnd[1]);
- return false;
- }
- this.onError();
- return true;
- }
- case (ST_LOGIN_RES+1):
- this.getHtml(this.mailURL);
- return false;
- case (ST_LOGIN_RES+2):
- var fnd=aData.match(/id=\"UIFrame\".+?src=\"(\S+)\"/);
- if(fnd){
- fnd=fnd[1].replace(/(\d+);/g,function(){return String.fromCharCode(RegExp.$1);});
- this.dataURL=fnd;
- var url=this.dataURL.match(/(((\S+):\/\/([^/]+))(\S*\/)?)([^/]*)/);
- if(url)this.mailHost=url[2];
- this.stage=ST_DATA;
- break;
- }
- this.onError();
- return true;
- }
- return this.baseProcess(aHttpChannel, aData);
- }
- function getCount(aData){
- return this.mailCount;
- }
- function getData(aData){
- var obj={};
- var ar=[];
- this.folders={};//used for direct link
- var fnd0=aData.match(/<ul.+?folderList.+?>([\s\S]+?)<\/ul>/);
- if(fnd0){
- var fnd=fnd0[1].match(/<li\s+fid=\"fid\"[\s\S]+?>.+?<\/li>/g);
- if(fnd){
- var s;
- var num=0;
- for each(s in fnd){
- s=s.match(/\s+id=\"(.+?([^-]+?))\".+?count=\"(\d+)\".+?title=\"(.+?)\"/);
- if(s){
- if(s[2]=="000000000005"||s[2]=="000000000004"
- ||s[2]=="000000000003"||s[2]=="000000000002")continue;
- var n=parseInt(s[3]);
- if(this.inboxOnly){
- if(s[2]=="000000000001")num=n;
- }else num+=n;
- if(n>0&&s[2]!="000000000001"){
- var name=s[4];
- name=name.replace(/(\d+);/g,function(){return String.fromCharCode(RegExp.$1);});
- var f=name.match(/(.+?)\s\(\d+\)/);
- if(f)name=f[1];
- this.folders[name]=s[1];
- ar.push(name);
- ar.push(n);
- }
- }
- }
- this.mailCount=num;
- if(this.showFolders){
- if(ar)obj.folders=encodeArray(ar);
- }
- return obj;
- }
- }
- this.mailCount=-1;
- return obj;
- }
- function getMailURL(aFolder){
- if(aFolder&&this.mailHost){
- var url=this.mailHost+"/mail/InboxLight.aspx?FolderID="+this.folders[aFolder]
- +"&n="+parseInt(Math.random()*1000000000);
- return url;
- }
- return this.mailURL;
- }
-